

class LoadingView extends egret.Sprite implements RES.PromiseTaskReporter {

    public constructor() {
        super();
        this.createView();
    }

    private textField: egret.TextField = new egret.TextField;

    private createView(): void {
        this.addChild(this.textField);
        this.textField.fontFamily = Const.YaHei;
        this.textField.size = 32;
        this.textField.textColor = 0xfff;
        this.textField.textAlign = egret.HorizontalAlign.CENTER;
        this.textField.verticalAlign = egret.VerticalAlign.MIDDLE;
        this.once(egret.Event.ADDED_TO_STAGE, function () {
            this.textField.height = Main.instance.height;
            this.textField.width = Main.instance.width;
        }, this);
    }

    public onProgress(current: number, total: number): void {
        this.textField.text = Math.floor(current / total * 100) + "%";
    }

}
